from day02.baseclass import BaseClass
from selenium.webdriver.common.by import By
from time import sleep
d=BaseClass()
#准备数据
data={
    "name":"lili",
    "pwd":"12345",
    "check":"5432",
    "mobile":"123456778",
    "mesg":"hello"
}
#对frame1的定位和操作
location = [By.ID, By.NAME, By.XPATH, By.CSS_SELECTOR]
def frame1_operate():
    myname = d.locator(location[0], 'username')
    mypassword = d.locator(location[0], 'password')
    mycheck = d.locator(location[2], '//input[@name="check"]')
    mymobile = d.locator(location[2], '//input[@name="mobile"]')
    mymesg = d.locator(location[2], '//textarea')
    mysubmit = d.locator(location[3], 'input#submit')
    sleep(1)
    myname.clear()
    myname.send_keys(data['name'])
    mypassword.send_keys(data["pwd"])
    mycheck.send_keys(data["check"])
    mymesg.clear()
    mymesg.send_keys(data["mesg"])
    sleep(2)
    mysubmit.click()

#对frame2的定位和操作
def frame2_operate():
    #页面元素的定位
    female=d.locator(By.ID,"female")
    airplane=d.locator(By.ID,"a")
    type1=d.locator(By.ID,"a1")
    type4=d.locator(By.ID,"a4")
    #操作
    sleep(2)
    female.click()
    sleep(2)
    airplane.click()
    sleep(2)
    type1.click()
    sleep(2)
    type4.click()
    sleep(2)

